--- interact_link: content/berlin.ipynb kernel_name: python3 kernel_path: content has_widgets: false title: |- Berlin pagenum: 1 prev_page: url: /main.html next_page: url: /italy.html suffix: .ipynb search: berlin data www de intensivregister periodically landesamt fr und soziales corona fallstatistik intensive care city reported gesundheit council outbreak daily variation capacity hospitals report availability beds currently treated patients shown below compared federal states overall national statistics source divi gesuundheit comment: "***PROGRAMMATICALLY GENERATED, DO NOT EDIT. SEE ORIGINAL FILES IN /content***" ---
Berlin

Data for Berlin

Data for the city of Berlin are periodically reported from the Landesamt für Gesundheit und Soziales of the Berlin Council.

import os,sys
sys.path.insert(0, os.path.normpath(os.path.join(os.path.abspath(''), '../../Code')))
from hedera_covid import DataHandlerBerlin, smooth_data

# for plotly
from plotly.offline import iplot
from plotly.offline import init_notebook_mode, plot
from IPython.core.display import display, HTML
import plotly as py
import plotly.tools as tls

import datetime
import numpy as np
import pandas as pd

# load data
berlin = DataHandlerBerlin()


# intensive care
berlin_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'berlin')
germany_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'germany')
bayern_h = pd.read_excel('../../DE-Data/intensive-care-data.xlsx',sheet_name = 'bayern')



    
    

Outbreak over time

import plotly.graph_objects as go
init_notebook_mode(connected=True)

fig = go.Figure()

N = len(berlin.data['dates'])

fig.add_trace(go.Bar(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['confirmed'],7),
    name='Reported Cases (Total = ' + str(berlin.data['confirmed'][N-1]) + ')'
))
fig.add_trace(go.Bar(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['deaths'],7),
    name='Reported Deaths (Total = ' + str(berlin.data['deaths'][N-1]) + ')'
))


fig.add_trace(go.Scatter(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['stationary'],7),
    name='In Hospital (Total = ' + str(berlin.data['stationary'][N-1]) + ')'
))

fig.add_trace(go.Scatter(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['intensive'],7),
    name='Intensive Care (Total = ' + str(berlin.data['intensive'][N-1]) + ')'
))
    
fig.update_layout(xaxis_tickangle=-90)

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Daily variation

import plotly.graph_objects as go
init_notebook_mode(connected=True)

fig = go.Figure()


fig.add_trace(go.Bar(
    x=berlin.data['dates'],
    y=berlin.data['confirmed_daily'],
    name='Daily Reported Cases (Total = ' + str(berlin.data['confirmed'][N-1]) + ')',
    marker = {'color': "#117A65"}
))
n_smooth = 7
fig.add_trace(go.Scatter(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['confirmed_daily'],n=n_smooth),
    name='Averaged over ' + str(n_smooth) + ' days',
    marker = {'color': "#48C9B0"}
))


fig.add_trace(go.Bar(
    x=berlin.data['dates'],
    y=berlin.data['deaths_daily'],
    name='Daily Reported Deaths (Total = ' + str(berlin.data['deaths'][N-1]) + ')',
    marker = {'color':'#F7DC6F'}
))

n_smooth = 3
fig.add_trace(go.Scatter(
    x=berlin.data['dates'],
    y=smooth_data(berlin.data['deaths_daily'],n=n_smooth),
    name='Averaged over ' + str(n_smooth) + ' days',
    marker = {'color': "#EB984E"}
))
    
fig.update_layout(xaxis_tickangle=-90)
fig.update_layout(legend=dict(x=0.1, y=1.2),legend_orientation="h",font_size=10)

plot(fig, filename = 'figure.html')
display(HTML('figure.html'))

Capacity of intensive care

Some hospitals report periodically data about the availability of intensive care beds and of currently treated patients. The data for Berlin are shown below, compared with other federal states and with the overall national statistics.

import plotly.graph_objects as go
init_notebook_mode(connected=True)

fig = go.Figure()


fig.add_trace(go.Bar(
    x=germany_h['Date'],
    y=germany_h['Percentage'],
    name='Germany',
    marker = {'color': "#F7DC6F"}
))
fig.add_trace(go.Bar(
    x=berlin_h['Date'],
    y=berlin_h['Percentage'],
    name='Berlin',
    marker = {'color': "#117A65"}
))
fig.add_trace(go.Bar(
    x=bayern_h['Date'],
    y=bayern_h['Percentage'],
    name='Bayern',
    marker = {'color': "#48C9B0"}
))


fig.update_layout(xaxis_tickangle=-90)
fig.update_layout(title='Percentage of intensive beds free',legend=dict(x=0.1, y=-.1),
                  legend_orientation="h",font_size=10)

#fig.show()
plot(fig, filename = 'figure.html')
display(HTML('figure.html'))
g=10
from IPython.display import display, Markdown
N = len(germany_h['Reporting'])
g= germany_h['Reporting'][N-1]
d = germany_h['Date'][N-1]
display(Markdown(f'**Note** The graphics take into account only the reporting entities ({g} on {d})'))

Note The graphics take into account only the reporting entities (1058 on 2020-04-15)